package com.own.business.system.user.controller.user.entity.form;

import com.own.component.common.exception.BusinessSimpleException;
import com.own.component.common.util.FormUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * UpdateUserNameForm
 *
 * @author chenxueli
 * @date 2024-03-23 21:17:00
 */
@Data
public class UpdateUserPhoneForm implements Serializable {

    @Schema(title = "用户手机号")
    private String phone;

    public void check() {
        if (StringUtils.isBlank(phone)) {
            throw new BusinessSimpleException("手机号不能为空");
        }
        if (!FormUtil.isPhone(phone)) {
            throw new BusinessSimpleException("手机号格式不正确");
        }
    }

}
